package design_mode.工厂模式;

import java.util.Scanner;

public class PrintLn {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入数字A:");
        Double numberA = Double.parseDouble(sc.nextLine());
        System.out.println("请选择运算符号：");
        String strOperate = sc.nextLine();
        System.out.println("请输入数字B:");
        Double numberB = Double.parseDouble(sc.nextLine());
        // 工厂创建
//        double result = OperationFactory.createOperation(strOperate).getResult(numberA, numberB);
        double result = new OperationContext(strOperate).operationInterface(numberA, numberB);
        System.out.printf("结果：%s", result);
    }
}
